<script>
  export default {
    name: 's-image-preview',
    data() {
      return {
        imageUrl: '',
        confirm: null,
        isShowControls: true,
        showHeight: true,
        is_del: false,
      };
    },
    methods: {
      openPopup(obj) {
        this.imageUrl = obj.imageUrl;
        // 是否显示操作
        if (obj.isShowControls == false) {
          this.isShowControls = obj.isShowControls;
        }
        if (obj.is_del == true) {
          this.is_del = obj.is_del;
        }
        this.confirm = obj.confirm;
        this.$refs.popup.open();
      },
      closePopup() {
        this.$refs.popup.close();
        this.imageUrl = '';
        this.confirm = null;
        this.isShowControls = true;
        this.showHeight = true;
        this.is_del = false;
      },
    },
  };
</script>

<template>
  <uni-popup ref="popup">
    <view class="wh_750 flex align-center justify-center"
          style="height: 100vh;position: relative;background: rgba(0,0,0,0.1)"
          @click.stop="closePopup">
      <image :src="imageUrl" style="height: 800rpx" v-if="showHeight" mode="aspectFit"></image>
      <image :src="imageUrl" v-else mode="aspectFit"></image>
      <view style="position: absolute;bottom: 120rpx;left: 50%;transform: translateX(-50%);"
            v-if="isShowControls"
      >
        <!--        <view class="bg_F5F5F5 wh_350 flex align-center justify-center fs_32 fw_500"-->
        <!--              style="border-radius: 32rpx;padding: 10rpx 0;color: #4e4e4e;"-->
        <!--              v-if="is_del"-->
        <!--              @click.stop="this.confirm"-->
        <!--        >-->
        <!--          删除照片-->
        <!--        </view>-->
        <view class="bg_FF4206 wh_350 flex align-center justify-center fs_32 color_FFFFFF fw_500 mt_15"
              style="border-radius: 32rpx;padding: 15rpx 0"
              @click.stop="this.confirm"
        >
          更换照片
        </view>
      </view>
    </view>
  </uni-popup>
</template>

<style scoped lang="scss">

</style>